/**
 * Created by China Wang on 5/28/14.
 */
public class Triangle {

    public static void main(String[] args) {
        printOne();
        System.out.println();
        printHorizontalLine(5);
        System.out.println();
        printVerticalLine(5);
        System.out.println();
        printRightTriangle(5);
        System.out.println();
    }

    // Easiest exercise ever
    // Print one asterisk to the console
    public static void printOne() {
        System.out.println("*");
    }

    // Draw a horizontal line
    // Given a number n, print n asterisks on one line
    public static void printHorizontalLine(int n) {
        String line = "";
        for (int i = 0; i < n; i++) {
            line += "*";
        }
        System.out.println(line);
    }

    // Draw a vertical line
    // Given a number n, print n lines, each with one asterisks
    public static void printVerticalLine(int n) {
        for (int i = 0; i < n; i++) {
            printOne();
        }
    }

    // Draw a right triangle
    // Given a number n, print n lines, each with one more asterisk than the last
    // (i.e. one on the first line, two on the second, etc.)
    public static void printRightTriangle(int n) {
        for (int i = 0; i < n; i++) {
            printHorizontalLine(i+1);
        }
    }

}
